package com.ruoyi.web.a2.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.CommonOKNOEnum;
import com.ruoyi.web.a2.dto.PointCleanJson;
import com.ruoyi.web.a2.service.ITool2aBlankValueFillService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "空值填充（免登录）")
@RestController
@RequestMapping("/webs/tool2aBlankValueFill")
public class ToolController extends BaseController
{

    //空值填充
    @Autowired
    private ITool2aBlankValueFillService tool2aBlankValueFillService;

    @ApiOperation("业务处理（AIS）")
    @PostMapping("/handleAIS")
    public AjaxResult handleAIS(@Validated @RequestBody final PointCleanJson json)
    {
        if(json.getIntervalTime()==null){
            return AjaxResult.error("空值填充的时候，间隔时间是必填项！");
        }
        return AjaxResult.success(tool2aBlankValueFillService.handleAIS(json));
    }

    @ApiOperation("业务处理（ADS-B）")
    @PostMapping("/handleADS")
    public AjaxResult handleADS(@Validated @RequestBody final PointCleanJson json)
    {
        if(json.getIntervalTime()==null){
            return AjaxResult.error("空值填充的时候，间隔时间是必填项！");
        }
        return AjaxResult.success(tool2aBlankValueFillService.handleADS(json));
    }


    public static void main(String[] args) {
        String templateSql = "UPDATE %s SET sfwckztc = %d , jd = %f , wd = %f , qxzt = %d WHERE id = %d";
        String sql = String.format(templateSql, "", CommonOKNOEnum.OK.getCode(),
                123.6,23.6,1,1);
        System.out.println(sql);
    }


}
